home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / text / GapContent$RemoveUndo.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  1.5 KB  |  52 lines

  1. package javax.swing.text;
  2.  
  3. import java.util.Vector;
  4. import javax.swing.undo.AbstractUndoableEdit;
  5. import javax.swing.undo.CannotRedoException;
  6. import javax.swing.undo.CannotUndoException;
  7.  
  8. class GapContent$RemoveUndo extends AbstractUndoableEdit {
  9.    // $FF: synthetic field
  10.    private final GapContent this$0;
  11.    protected int offset;
  12.    protected int length;
  13.    protected String string;
  14.    protected Vector posRefs;
  15.  
  16.    protected GapContent$RemoveUndo(GapContent var1, int var2, String var3) {
  17.       this.this$0 = var1;
  18.       this.offset = var2;
  19.       this.string = var3;
  20.       this.length = var3.length();
  21.       this.posRefs = var1.getPositionsInRange((Vector)null, var2, this.length);
  22.    }
  23.  
  24.    public void redo() throws CannotRedoException {
  25.       super.redo();
  26.  
  27.       try {
  28.          this.string = this.this$0.getString(this.offset, this.length);
  29.          this.posRefs = this.this$0.getPositionsInRange((Vector)null, this.offset, this.length);
  30.          this.this$0.remove(this.offset, this.length);
  31.       } catch (BadLocationException var1) {
  32.          throw new CannotRedoException();
  33.       }
  34.    }
  35.  
  36.    public void undo() throws CannotUndoException {
  37.       super.undo();
  38.  
  39.       try {
  40.          this.this$0.insertString(this.offset, this.string);
  41.          if (this.posRefs != null) {
  42.             this.this$0.updateUndoPositions(this.posRefs, this.offset, this.length);
  43.             this.posRefs = null;
  44.          }
  45.  
  46.          this.string = null;
  47.       } catch (BadLocationException var1) {
  48.          throw new CannotUndoException();
  49.       }
  50.    }
  51. }
  52.